package serializer

import (
	"gin_mall_tmp/model"
	"gin_mall_tmp/pkg/utils"
)

type Money struct {
	UserId    uint   `json:"userId" form:"userId"`
	UserName  string `json:"userName" form:"userName"`
	UserMoney string `json:"userMoney" form:"userMoney"`
}

func BuildMoney(item *model.User, key string) Money {
	utils.Encrypt.SetKey(key)
	return Money{
		UserId:    item.ID,
		UserName:  item.UserName,
		UserMoney: utils.Encrypt.AesDecoding(item.Money),
	}
}
